Eclipse Platform
Pre-release 3.0

org.eclipse.team.core.subscribers
Class RemoteBytesSynchronizer

java.lang.Object
  extended byorg.eclipse.team.core.subscribers.RemoteSynchronizer
      extended byorg.eclipse.team.core.subscribers.RemoteBytesSynchronizer

public abstract class RemoteBytesSynchronizer
extends RemoteSynchronizer

A remote bytes sychronizer is a remote synchronizer that caches the remote sync bytes using the org.eclipse.core.resources.ISynchronizer. It also has API that differentiates the case of no existing remote for a local resource from that of the remote state never having been queried for that local resource.


Field Summary
protected  QualifiedName syncName
           
 
Constructor Summary
RemoteBytesSynchronizer(QualifiedName name)
           
 
Method Summary
 void dispose()
          Dispose of any cached sync bytes.
 byte[] getSyncBytes(IResource resource)
          Return the remote sync bytes cached for the given local resource.
protected  ISynchronizer getSynchronizer()
           
protected  QualifiedName getSyncName()
           
 boolean hasRemote(IResource resource)
          Return whether the given resource has a corresponding remote resource that is known to exist (at the last point in time that a refresh was performed).
 boolean isRemoteKnown(IResource resource)
          Return true if the remote resources associated with the given local resource has been fetched.
 boolean removeSyncBytes(IResource resource, int depth)
          Remove the remote bytes cached for the given local resource.
protected  boolean setRemoteDoesNotExist(IResource resource)
          This method should be invoked by a client to indicate that it is known that there is no remote resource associated with the local resource.
 boolean setSyncBytes(IResource resource, byte[] bytes)
          Set the remote sync bytes for the given resource.
 
Methods inherited from class org.eclipse.team.core.subscribers.RemoteSynchronizer
getRemoteResource, refresh
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

syncName

protected QualifiedName syncName
Constructor Detail

RemoteBytesSynchronizer

public RemoteBytesSynchronizer(QualifiedName name)
Method Detail

dispose

public void dispose()
Dispose of any cached sync bytes.


getSynchronizer

protected ISynchronizer getSynchronizer()

getSyncName

protected QualifiedName getSyncName()

getSyncBytes

public byte[] getSyncBytes(IResource resource)
                    throws TeamException
Return the remote sync bytes cached for the given local resource. A return value of null can mean either that the remote has never been fetched or that it doesn't exist. The method isRemoteKnown(IResource) should be used to differentiate these two cases.

Throws:
TeamException

setSyncBytes

public boolean setSyncBytes(IResource resource,
                            byte[] bytes)
                     throws TeamException
Set the remote sync bytes for the given resource. The bytes should never be null. If it is known that the remote does not exist, setRemoteDoesNotExist(IResource) should be invoked. If the sync bytes for the remote are stale and should be removed, removeSyncBytes() should be called.

Parameters:
resource -
bytes -
Returns:
true if the sync bytes changed
Throws:
TeamException

removeSyncBytes

public boolean removeSyncBytes(IResource resource,
                               int depth)
                        throws TeamException
Remove the remote bytes cached for the given local resource. After this operation isRemoteKnown(resource) will return false and getSyncBytes(resource) will return null for the resource (and potentially it's children depending on the value of the depth parameter.

Returns:
true if there were bytes present which were removed
Throws:
TeamException

isRemoteKnown

public boolean isRemoteKnown(IResource resource)
                      throws TeamException
Return true if the remote resources associated with the given local resource has been fetched. This method is useful for those cases when there are no sync bytes for a remote resource and the client wants to know if this means that the remote does exist (i.e. this method returns true) or the remote has not been fetched (i.e. this method returns false).

Throws:
TeamException

setRemoteDoesNotExist

protected boolean setRemoteDoesNotExist(IResource resource)
                                 throws TeamException
This method should be invoked by a client to indicate that it is known that there is no remote resource associated with the local resource. After this method is invoked, isRemoteKnown(resource) will return true and getSyncBytes(resource) will return null.

Returns:
true if this changes the remote sync bytes
Throws:
TeamException

hasRemote

public boolean hasRemote(IResource resource)
                  throws TeamException
Description copied from class: RemoteSynchronizer
Return whether the given resource has a corresponding remote resource that is known to exist (at the last point in time that a refresh was performed).

Specified by:
hasRemote in class RemoteSynchronizer
Parameters:
resource - the local resource handle
Returns:
true if a corrrespondin remote resource is know to exist
Throws:
TeamException

Eclipse Platform
Pre-release 3.0

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.